﻿using AuApmt.Models.DbModels;
using Microsoft.EntityFrameworkCore;

namespace AuApmt.Models.Db.Context
{
    public abstract class DataContext: DbContext
    {
        protected readonly DataContextOptions _options;
        protected abstract string AcceptDbType { get; }
        protected DataContext(DataContextOptions options)
        {
            if (options.Type?.ToLower() != AcceptDbType)
                throw new InvalidOperationException(
                    $"数据库类型配置异常，应为:{AcceptDbType}");
            _options = options;
        }

        public DbSet<User> Users { get; set; }
        public DbSet<Client> Clients { get; set; }
        public DbSet<Subject> Subjects { get; set; }
        public DbSet<Schedule> Schedules { get; set; }
    }

    //Add-Migration xxxx -Context DataSqlServerContext -OutputDir Models/Db/Migrations/SqlServer
    //Remove-Migration -Context DataSqlServerContext
}
